#!/usr/bin/env node

const Dog=require('./05-dog');

const d1= new Dog('taidi',4),
      d2= new Dog('zangao',8);

function onBark(){
    console.log(this.name,this.energy);
}

d1.on('bark',onBark.bind(d1));
d2.on('bark',onBark.bind(d2));

setTimeout(()=>{
    d1.energy=8;
},6000)